import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    component: () => import('@/views/Login')
  },
  {
    path: '/home',
    component: () => import('@/views/Home'),
    children: [
      {
        path: '/welcome',
        component: () => import('@/views/welcome')
      },
      {
        path: '/users',
        component: () => import('@/views/User'),
        meta:{auth:true}
      },
      {
        path: '/roles',
        component: () => import('@/views/Roles/roles')
      },
      {
        path: '/rights',
        component: () => import('@/views/Roles/rights')
      },
      {
        path: '/goods',
        component: () => import('@/views/ShopList/goods')
      },
      {
        path: '/goodsadd',
        component: () => import('@/views/ShopList/goodsadd')
      },
      {
        path: '/categories',
        component: () => import('@/views/ShopList/categories')
      },
      {
        path: '/params',
        component: () => import('@/views/ShopList/params')
      },
      {
        path: '/orders',
        component: () => import('@/views/orders')
      },
      {
        path: '/reports',
        component: () => import('@/views/reports')
      },
    ],
    redirect: '/welcome'
  },
]

const router = new VueRouter({
  routes
})

export default router
